package com.gupao.prototype;

import com.gupao.prototype.deap.DeapPrototypeA;

import java.util.ArrayList;

public class TestDeapPrototype {
    public static void main(String[] args) {
        DeapPrototypeA p1 = new DeapPrototypeA();
        p1.setAge(25);
        p1.setName("王斌");
        p1.setHobbies(new ArrayList<String>());

        DeapPrototypeA p2 = (DeapPrototypeA) p1.clone();

        System.out.println("原对象中成员变量值为：" + p1.getHobbies());
        System.out.println("克隆对象中成员变量值为：" + p2.getHobbies());
        System.out.println("原对象和克隆对象的成员变量引用地址比较：" + (p1.getHobbies() == p2.getHobbies()));
    }
}
